<script lang="ts" setup>
const emit = defineEmits<{
  (e: 'refresh'): void
}>()

interface Props {
  description?: string
  loading?: boolean
}

const props = withDefaults(defineProps<Props>(), {
  loading: false,
})

const refresh = (): void => {
  if (!props.loading) {
    emit('refresh')
  }
}
</script>

<template>
  <el-empty :description="description">
    <template v-if="!description" #description>
      <span class="mr-1">暂无内容，点击</span>
      <el-button type="primary" link :disabled="loading" @click="refresh"> 刷新 </el-button>
    </template>
  </el-empty>
</template>
